package com.huitone.gddw.controller.monitoring;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import org.springframework.web.bind.annotation.ResponseBody;




import com.huitone.gddw.dao.entity.ReturnedValue;
import com.huitone.gddw.dao.entity.TomcatItem;

import com.huitone.gddw.service.TomcatItemService;
/**
 * 环境监控管理器
 * @author Administrator
 *
 */

import com.huitone.gddw.utils.MonitoringResult;
/**
 * tomcat监控Controller
 * @author lipengfei
 *
 */
@Controller
@RequestMapping(value="tommon")
public class TomcatlMonitoringController {
	
	private final static Logger LOGGER = Logger.getLogger(TomcatlMonitoringController.class);
	
	@Resource
	private TomcatItemService tomService;
	
	@ResponseBody
	@RequestMapping(value="/showTom",method=RequestMethod.POST)
	public MonitoringResult<List<TomcatItem>> show(ReturnedValue value){
		
		MonitoringResult<List<TomcatItem>> result = 
				tomService.loadTomcatItem(value);
		LOGGER.info("显示tomcat监控的数据完成");
		return result;
	}
	@ResponseBody
	@RequestMapping(value="/addIndex",method=RequestMethod.POST)
	public MonitoringResult<Map<String,Object>> add(){
		MonitoringResult<Map<String,Object>> result = 
				tomService.addIndex();
		LOGGER.info("tomcat监控指标添加完成");
		return result;
	}
	@ResponseBody
	@RequestMapping(value="/showIndex",method=RequestMethod.POST)
	public MonitoringResult<Map<String,Object>> showIndex(ReturnedValue value){
		MonitoringResult<Map<String,Object>> result = 
				tomService.showIndex(value);
		LOGGER.info("tomcat监控指标添加完成");
		return result;
	}
	@ResponseBody
	@RequestMapping(value="/saveIndex",method=RequestMethod.POST)
	public MonitoringResult<TomcatItem> saveIndex(ReturnedValue value){
		MonitoringResult<TomcatItem> result = 
				tomService.save(value);
		LOGGER.info("tomcat监控指标添加完成");
		return result;
	}
	@ResponseBody
	@RequestMapping(value="/showInfo",method=RequestMethod.POST)
	public MonitoringResult<Map<String,Object>> showInfo(ReturnedValue value){
		MonitoringResult<Map<String,Object>> result = 
				tomService.showInfo(value);
		LOGGER.info("tomcat具体信息添加完成");
		return result;
	}
//	@ResponseBody
//	@RequestMapping(value="/updataIndex",method=RequestMethod.POST)
//	public MonitoringResult<Map<String,Object>> updataIndex(ReturnedValue value){
//		MonitoringResult<Map<String,Object>> result = 
//				tomService.updata(value);
//		LOGGER.info("tomcat监控指标添加完成");
//		return result;
//	}
	
}
